.graph-page {
  --graph-line: #e6e4ec;
  --graph-muted: #675f73;
  --graph-soft: #f8f8fb;
  --graph-accent: #6944b1;
  --graph-event: #806022;
  --graph-engagement: #497464;
  min-width: 0;
}

.graph-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 22px;
  margin-bottom: 19px;
}

.graph-heading h1 { font-size: 27px; line-height: 1.2; margin: 0; }
.graph-counts { display: flex; flex-wrap: wrap; gap: 8px 17px; color: var(--graph-muted); font-size: 12px; }
.graph-counts strong { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }

.graph-query {
  display: grid;
  grid-template-columns: minmax(160px, 1.45fr) repeat(2, minmax(105px, 1fr)) repeat(2, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 11px;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--white);
  border: 1px solid var(--graph-line);
  border-radius: 8px;
}

.graph-query label { min-width: 0; }
.graph-query label > span { display: block; color: var(--graph-muted); font-size: 12px; font-weight: 650; margin-bottom: 6px; }
.graph-query input:not([type=checkbox]), .graph-query select { min-width: 0; height: 37px; padding: 7px 9px; font-size: 12px; border-radius: 6px; }
.graph-query-actions { display: flex; gap: 6px; }
.graph-query-actions .button { height: 37px; padding: 6px 11px; border-radius: 6px; }

.graph-matches { margin: 0 0 14px; }
.graph-matches h2, .graph-company-list h3 { margin: 0 0 7px; font-size: 12px; color: var(--graph-muted); }
.graph-matches h2 span { margin-left: 5px; font-variant-numeric: tabular-nums; }
.graph-matches ul, .graph-company-list ul, .graph-list, .graph-legend { list-style: none; margin: 0; padding: 0; }
.graph-matches ul { display: flex; flex-wrap: wrap; gap: 6px; max-height: 106px; overflow: auto; padding: 4px; margin: -4px; }
.graph-matches li, .graph-company-list li { min-width: 0; max-width: 100%; }
.graph-match { background: var(--white); border: 1px solid var(--graph-line); border-radius: 6px; color: #4a4258; text-align: left; padding: 6px 9px; overflow-wrap: anywhere; font-size: 12px; }
.graph-match:hover, .graph-match.is-current { border-color: #ab93d0; color: #52318a; background: #f5f0fd; }
.graph-matches p { margin: 4px 0; color: var(--graph-muted); font-size: 12px; }
.graph-request-state { color: var(--graph-muted); margin: 0 0 12px; font-size: 12px; line-height: 1.6; }
.graph-request-state.is-error { padding: 8px 10px; background: #fff3f3; border: 1px solid #eed7d7; border-radius: 6px; color: #8e3745; }

.graph-workspace { display: grid; grid-template-columns: minmax(0, 2.25fr) minmax(230px, 1fr); gap: 12px; align-items: start; }
.graph-panel, .graph-inspector { min-width: 0; background: var(--white); border: 1px solid var(--graph-line); border-radius: 8px; }
.graph-panel-head, .graph-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 47px; }
.graph-panel-head { padding: 8px 12px; border-bottom: 1px solid var(--graph-line); }
.graph-panel-head h2, .graph-section-head h2 { margin: 0; font-size: 14px; }
.graph-tools, .graph-zoom { display: flex; align-items: center; gap: 4px; }
.graph-tools { gap: 7px; }
.graph-tools button { min-height: 28px; border: 1px solid var(--graph-line); border-radius: 5px; background: var(--white); color: #544963; }
.graph-tools button:hover:not(:disabled) { color: var(--graph-accent); border-color: #a890cb; }
.graph-mode { padding: 4px 8px; font-size: 11px; }
.graph-mode[aria-pressed="true"] { background: #f1f6f3; border-color: #c5dad1; color: #315f50; }
.graph-zoom button { min-width: 28px; padding: 0; font-size: 16px; }
.graph-viewport { position: relative; height: 389px; background: #f9f9fc; }
.graph-canvas { position: absolute; inset: 0; }
.graph-canvas-message { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--graph-muted); font-size: 12px; padding: 20px; }
.graph-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 15px; padding: 9px 12px; border-top: 1px solid var(--graph-line); }
.graph-legend li { display: flex; align-items: center; gap: 5px; color: var(--graph-muted); font-size: 11px; white-space: nowrap; }
.graph-symbol { display: inline-block; width: 12px; height: 8px; border: 1px solid #8f73bd; background: #efe8fb; border-radius: 2px; }
.graph-symbol.focus { border-color: #4a287f; background: #4a287f; }
.graph-symbol.event { border-color: #a37a2a; background: #fff4d8; }
.graph-symbol.relationship, .graph-symbol.participation { border: 0; border-top: 2px solid #8769b4; background: none; height: 0; width: 15px; border-radius: 0; }
.graph-symbol.participation { border-top-color: var(--graph-engagement); border-top-style: dashed; }

.graph-inspector { min-height: 265px; }
.graph-detail { padding: 13px; overflow-wrap: anywhere; }
.graph-detail h3 { margin: 0 0 9px; font-size: 16px; line-height: 1.45; }
.graph-detail-fields { margin: 0 0 9px; }
.graph-detail-fields div { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 5px 0; font-size: 12px; }
.graph-detail-fields dt { color: var(--graph-muted); }
.graph-detail-fields dd { margin: 0; font-weight: 600; }
.graph-detail-links, .graph-detail-actions { display: flex; flex-wrap: wrap; gap: 6px 9px; }
.graph-detail-actions { margin-top: 11px; }
.graph-detail-actions .button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.graph-detail-entities, .graph-detail-date { color: var(--graph-muted); margin: 4px 0; font-size: 12px; line-height: 1.55; }
.graph-company-list { border-top: 1px solid var(--graph-line); padding: 11px 13px; }
.graph-company-list ul { max-height: 145px; overflow: auto; padding: 3px; margin: -3px; }
.graph-company-list li + li { margin-top: 2px; }
.graph-company-option { width: 100%; text-align: left; padding: 5px 7px; background: transparent; color: #463b54; border: 1px solid transparent; border-radius: 4px; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.graph-company-option:hover, .graph-company-option[aria-pressed="true"] { background: #f4f0fb; border-color: #e0d5f2; color: #59358f; }

.graph-evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; margin-top: 14px; }
.graph-records { min-width: 0; border-top: 1px solid var(--graph-line); }
.graph-section-head { padding: 4px 3px; }
.graph-section-head span { color: var(--graph-muted); font-size: 12px; }
.graph-list { padding: 0 3px; }
.graph-list > li { padding: 10px 0; border-top: 1px solid var(--graph-line); min-width: 0; overflow-wrap: anywhere; }
.graph-record-top { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 8px; color: var(--graph-muted); font-size: 11px; }
.graph-record-top time, .graph-detail-date time { color: #4f455d; font-variant-numeric: tabular-nums; font-weight: 650; }
.graph-type { color: #543582; background: #f0eaf8; border-radius: 4px; padding: 2px 5px; }
.graph-timeline { position: relative; }
.graph-timeline > li { position: relative; padding-left: 14px; }
.graph-timeline > li::before { content: ""; display: block; position: absolute; width: 6px; height: 6px; border: 1px solid #a77a33; background: #f7e7be; border-radius: 50%; top: 15px; left: 0; }
.graph-timeline .graph-type { color: #70551e; background: #f6edda; }
.graph-record-title { display: block; padding: 0; margin: 4px 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 13px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.graph-record-title:hover, .graph-record-title[aria-pressed="true"] { color: var(--graph-accent); text-decoration: underline; }
.graph-date-kind { color: var(--graph-muted); }
.graph-note, .graph-participants { color: var(--graph-muted); font-size: 12px; line-height: 1.65; margin: 4px 0; white-space: pre-wrap; }
.graph-source, .graph-source-label { font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.graph-source { color: #5f3e9a; text-decoration: underline; text-underline-offset: 2px; }
.graph-source:hover { color: #40235f; }
.graph-source-label { color: var(--graph-muted); }
.graph-empty { padding: 12px 0; line-height: 1.55; color: var(--graph-muted); font-size: 12px; }
.graph-empty p { margin: 4px 0 0; }

@media (max-width: 1190px) {
  .graph-query { grid-template-columns: minmax(165px, 1.6fr) repeat(2, minmax(120px, 1fr)); }
}

@media (max-width: 920px) {
  .graph-workspace { grid-template-columns: minmax(0, 1.8fr) minmax(185px, 1fr); }
}

@media (max-width: 620px) {
  .graph-heading h1 { font-size: 23px; }
  .graph-query { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 9px; }
  .graph-search, .graph-query-actions { grid-column: 1 / -1; }
  .graph-workspace, .graph-evidence-grid { grid-template-columns: 1fr; }
  .graph-viewport { height: 310px; }
  .graph-inspector { min-height: 0; }
}
