:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-muted: #fbfbfb;
  --text: #111827;
  --text-soft: #4b5563;
  --text-faint: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #111827;
  --accent-soft: #f3f4f6;
  --danger: #b42318;
  --success: #166534;
  --warning: #b45309;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 10px 30px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: var(--text);
  text-decoration-color: rgba(17, 24, 39, 0.28);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: rgba(17, 24, 39, 0.65);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.8rem, 1.2rem + 1.8vw, 2.6rem);
  font-weight: 700;
}

h2 {
  font-size: 1.2rem;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
}

p,
ul,
ol,
table,
pre {
  margin-top: 0;
}

code {
  font-size: 0.92em;
  background: #f3f4f6;
  border: 1px solid #eceff1;
  padding: 0.08rem 0.32rem;
  border-radius: 0.45rem;
}

.messages {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.messages .message {
  padding: 0.8rem 0.95rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid #dbe2ea;
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

nav.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.nav-links--end {
  justify-content: flex-end;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.nav-secondary-link,
.nav-user-label {
  font-size: 0.92rem;
  color: var(--text-soft);
  text-decoration: none;
}

.nav-user-label {
  white-space: nowrap;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0 0.1rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

.breadcrumbs a {
  color: var(--text-soft);
  text-decoration: none;
}

.breadcrumbs .current {
  color: var(--text);
  font-weight: 600;
}

.breadcrumbs .sep {
  color: #c0c5cd;
}

.card,
.status-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.three-col {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: block;
  margin-top: 0.9rem;
  margin-bottom: 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.68rem 0.82rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #9ca3af;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.06);
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

button,
.button-link,
.button-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.62rem 0.92rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button,
.button-link {
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}

button:hover,
.button-link:hover {
  color: #fff;
  background: #1f2937;
  text-decoration: none;
}

.button-subtle {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.button-subtle:hover {
  background: var(--accent-soft);
}

button[disabled],
.button-link[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  min-height: 0;
  max-width: none;
  flex-shrink: 0;
}

.hint {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.muted {
  color: var(--text-faint);
}

.errorlist,
.form-errors,
.high {
  color: var(--danger);
}

.medium {
  color: var(--warning);
}

.low {
  color: var(--success);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-ok {
  color: var(--success);
  background: #edfdf3;
  border-color: #d9f5e4;
}

.badge-off {
  color: var(--danger);
  background: #fef3f2;
  border-color: #f8d3d0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #eff2f4;
  padding: 0.7rem 0.8rem;
  vertical-align: top;
}

th {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--text-faint);
  background: #fafafa;
}

pre {
  background: #f7f7f8;
  padding: 0.9rem;
  overflow: auto;
  font-size: 0.84rem;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.tool-card-disabled {
  opacity: 0.7;
}

.tool-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tool-actions > *:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.button-link {
  white-space: nowrap;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  box-shadow: none;
}

.btn-link:hover {
  color: var(--text);
  background: none;
}

details {
  margin-top: 0.85rem;
}

summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.page-title {
  margin-bottom: 0.35rem;
}

.page-summary {
  margin-bottom: 0;
  color: var(--text-soft);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  text-align: right;
}

.eyebrow {
  margin-bottom: 0.35rem;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-hero {
  margin: 1rem 0 0.5rem;
  font-size: clamp(1.7rem, 1.2rem + 1vw, 2.4rem);
  font-weight: 750;
  letter-spacing: -0.03em;
}

.inline-form-spaced {
  margin-top: 0.9rem;
}

.button-danger {
  background: var(--danger);
}

.button-danger:hover {
  background: #912018;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.prose-card {
  margin-top: 1rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  line-height: 1.65;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding: 3rem 1rem 1rem;
}

.auth-card {
  width: min(100%, 28rem);
}

.auth-card-wide {
  width: min(100%, 32rem);
}

.auth-submit {
  margin-top: 1rem;
}

.auth-footnote {
  margin-top: 1.25rem;
}

/* LinkedIn: режим поиска (радио в одну колонку, круг слева, текст рядом) */
#tool-linkedin-apify .linkedin-mode-radios {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.35rem 0 0.85rem;
}
#tool-linkedin-apify .linkedin-mode-radios label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
#tool-linkedin-apify .linkedin-mode-radios input[type="radio"] {
  margin-top: 0;
  margin-bottom: 0;
  accent-color: #0f4c81;
}
#tool-linkedin-apify .linkedin-mode-radios label span {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.page-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17.5rem, 21rem);
  grid-template-areas: "main sidebar";
  gap: 1.25rem;
  align-items: start;
}
.page-main {
  grid-area: main;
  min-width: 0;
}
.section-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 1rem;
  min-width: 0;
  padding: 1rem 1.1rem;
}
.section-sidebar h2 {
  margin-top: 0;
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.section-sidebar nav {
  display: block;
  margin: 0;
}
.section-sidebar a {
  display: block;
  text-decoration: none;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.94rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.section-sidebar a:hover {
  background: #fafafa;
  border-color: var(--border);
}
.page-main > section:first-child,
.page-main > div:first-child {
  margin-top: 0;
}
.loading-indicator {
  display: none;
  margin-top: 0.85rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text-soft);
}
.loading-indicator.htmx-request {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.loading-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #d1d5db;
  border-top-color: var(--text);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
  flex: 0 0 auto;
}
form.htmx-request button[type="submit"] {
  opacity: 0.7;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* История инструментов на рабочем столе проекта */
.tool-search-history {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}
.tool-search-history-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
}
.tool-search-history-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: #fafbfc;
  padding: 0 0.75rem;
  min-width: 0;
}
.tool-search-history-item > summary {
  cursor: pointer;
  position: relative;
  padding: 0.55rem 0 0.55rem 1.05rem;
  font-size: 0.9rem;
  color: #1f2937;
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  overflow-wrap: anywhere;
}
.tool-search-history-item > summary::-webkit-details-marker {
  display: none;
}
.tool-search-history-item > summary::before {
  content: "";
  position: absolute;
  left: 0.05rem;
  top: 0.65rem;
  width: 0.32rem;
  height: 0.32rem;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(-45deg);
}
.tool-search-history-item[open] > summary::before {
  transform: rotate(45deg);
  top: 0.58rem;
}
.tool-search-history-time {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tool-search-history-body {
  padding: 0 0 0.85rem;
  border-top: 1px dashed #e5e7eb;
  margin-top: 0.25rem;
  max-height: 36rem;
  overflow: auto;
  font-size: 0.9rem;
  min-width: 0;
}
.tool-search-history-empty {
  margin-top: 0.75rem;
  font-size: 0.92rem;
}

@media (max-width: 960px) {
  .page-with-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "main";
  }
  .section-sidebar {
    position: static;
  }
}

/* --- OSINT workspace (трёхпанельный layout) --- */
body:has(#workspace-root) {
  --workspace-chrome-height: 8.25rem;
  max-width: 100%;
  margin: 0;
  padding: 0.75rem;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}
.workspace-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) minmax(320px, 380px);
  grid-template-rows: minmax(0, 1fr);
  gap: 1rem;
  overflow: hidden;
  align-items: stretch;
  min-height: 0;
  height: calc(100vh - var(--workspace-chrome-height));
  height: calc(100dvh - var(--workspace-chrome-height));
  max-height: calc(100vh - var(--workspace-chrome-height));
  max-height: calc(100dvh - var(--workspace-chrome-height));
}
.tool-palette--rail {
  grid-column: 1;
  grid-row: 1;
}
.tool-canvas {
  grid-column: 2;
  grid-row: 1;
}
.graph-panel {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  min-height: 0;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.tool-palette {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.9rem;
  box-shadow: var(--shadow-sm);
}
.palette-topbar {
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: 0.5rem;
}
/* Устаревшая кнопка «меню» в шапке палитры — не показывать (кэш / старые шаблоны) */
.tool-palette .palette-topbar > button {
  display: none !important;
}
.palette-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 2.6rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
.palette-home:hover {
  background: var(--accent-soft);
}
.palette-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
}
.palette-nav > .palette-nav-item,
.palette-nav > a,
.palette-nav > button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.palette-nav > .palette-nav-item:hover,
.palette-nav > a:hover,
.palette-nav > button:hover {
  background: #fafafa;
  border-color: #cbd5e1;
}
.workspace-tool-tile {
  position: relative;
  margin: 0;
}
.workspace-tile-close {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 2.1rem;
  min-height: 2.1rem;
  padding: 0;
  line-height: 1;
  font-size: 1.2rem;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.workspace-tile-close:hover {
  color: var(--text);
  background: #f3f4f6;
  border-color: #e5e7eb;
}
.tool-canvas {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-content: flex-start;
  background: transparent;
  scroll-behavior: smooth;
}
.tool-canvas-welcome.card {
  margin-bottom: 0;
}
.tool-canvas-welcome-title {
  margin-top: 0;
  margin-bottom: 0.35rem;
}
.tool-canvas-welcome-copy {
  margin-bottom: 0;
}
.graph-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.cy-root {
  flex: 1 1 0;
  min-height: 220px;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.entity-list-panel {
  max-height: 38%;
  min-height: 120px;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  background: #fff;
}
.entity-list-header {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.entity-bulk-form {
  margin: 0;
}
.entity-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.entity-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-soft);
  cursor: pointer;
  overflow: hidden;
}
.entity-select-all input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.entity-select-all span {
  font-size: 0.95rem;
  line-height: 1;
}
.entity-select-all:has(input:checked) {
  color: var(--text);
  background: #f3f4f6;
  border-color: #cbd5e1;
}
.entity-check-col {
  width: 2rem;
  text-align: center !important;
}
.entity-row {
  cursor: pointer;
}
.entity-row:hover {
  background: #fafafa;
}
.entity-row-deleted {
  opacity: 0.75;
}
.entity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  border: none;
  margin-top: 0;
}
.entity-table th,
.entity-table td {
  text-align: left;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}
.entity-table th {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 0.75rem;
  background: transparent;
}
.entity-label-cell {
  font-size: 0.78rem;
}
.entity-actions {
  white-space: nowrap;
  text-align: right;
}
.entity-delete-form {
  display: inline;
  margin: 0;
}
.entity-selection-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}
.entity-selection-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
}
.entity-selection-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.entity-selection-icon-btn,
.entity-selection-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  line-height: 1;
  font-size: 1rem;
}
.entity-selection-delete {
  border: 1px solid #dc2626;
  background: #dc2626;
  color: #fff;
  cursor: pointer;
}
.entity-selection-icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-soft);
  cursor: pointer;
}
.entity-selection-icon-btn:hover {
  color: var(--text);
  background: #f3f4f6;
}
.entity-selection-delete:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
.entity-selection-delete[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.entity-selection-toolbar--restore {
  border-color: #bfdbfe;
}
.entity-selection-restore {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
}
.entity-selection-restore:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.entity-selection-restore[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.entity-restore-list {
  margin-top: 0.75rem;
}
.entity-restore-list > summary {
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-soft);
}
.entity-restore-select-form {
  margin-top: 0.55rem;
}
.entity-table-muted {
  opacity: 0.9;
}
.entity-list-empty {
  margin: 0.35rem 0 0;
}
.btn-link.danger {
  color: #b91c1c;
}
.entity-detail-slot {
  border-top: 1px solid var(--border);
  padding: 0.85rem 1rem 1rem;
  max-height: 28%;
  overflow: auto;
  font-size: 0.85rem;
  background: #fcfcfc;
}
.entity-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.entity-detail-title {
  margin: 0;
  font-size: 1rem;
}
.entity-detail-meta {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.85rem;
}
.entity-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
.entity-detail-links a {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  text-decoration: none;
}
.entity-detail-summary {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  line-height: 1.45;
}
.entity-detail-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.entity-detail-facts span {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  font-size: 0.78rem;
  color: #334155;
}
.entity-detail-card .entity-json {
  font-size: 0.75rem;
  overflow: auto;
  max-height: 14rem;
  margin: 0.35rem 0 0;
  padding: 0.75rem;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
}
.entity-type-company {
  background: #dbeafe;
  color: #1e40af;
}
.entity-type-person {
  background: #dcfce7;
  color: #166534;
}
.entity-type-sanction {
  background: #fee2e2;
  color: #991b1b;
}
.tool-canvas > section.card,
.tool-canvas > div.grid,
.tool-canvas > .workspace-tool-tile {
  margin-top: 0 !important;
}
@media (max-width: 1100px) {
  body:has(#workspace-root) {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: auto;
  }
  .workspace-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(320px, 42vh);
    height: auto;
    max-height: none;
  }
  .tool-palette--rail {
    grid-column: 1;
    grid-row: 1;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    max-width: none;
    min-height: auto;
    padding: 0.5rem 0.75rem 0.65rem;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .tool-canvas {
    grid-column: 1;
    grid-row: 2;
  }
  .graph-panel {
    grid-column: 1;
    grid-row: 3;
    border-left: none;
    border-top: 1px solid #e5e7eb;
  }
  .tool-palette .palette-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.35rem;
  }
  .tool-palette .palette-nav > .palette-nav-item,
  .tool-palette .palette-nav > a,
  .tool-palette .palette-nav > button {
    width: auto;
    min-width: min(100%, 16rem);
    min-height: 2.6rem;
    font-size: 0.84rem;
  }
}
