:root {
  --viz-gap: 16px;
  --viz-border: #e5e7eb;
  --viz-bg: #f8fafc;
  --viz-card: #ffffff;
  --viz-muted: #64748b;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--viz-bg);
  color: #111827;
}

.viz-page {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: var(--viz-gap);
  padding: calc(var(--toolbar-h, 72px) + 18px) 18px 18px;
  box-sizing: border-box;
}

.viz-sidebar,
.viz-main {
  display: flex;
  flex-direction: column;
  gap: var(--viz-gap);
  min-width: 0;
}

.viz-card {
  background: var(--viz-card);
  border: 1px solid var(--viz-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  padding: 16px;
}

.viz-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.viz-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #374151;
}

.viz-select,
.viz-input {
  width: 100%;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
  font: inherit;
  box-sizing: border-box;
}

.viz-input {
  margin-bottom: 8px;
}

.viz-select:disabled,
.viz-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.viz-label.is-disabled,
.viz-check.is-disabled {
  color: #94a3b8;
}

.viz-check.is-disabled {
  opacity: 0.78;
}

.viz-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.viz-actions,
.viz-inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.viz-actions {
  margin-top: 16px;
}

.viz-help-box {
  margin-top: 14px;
  display: grid;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
}

.viz-help-item {
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.5;
}

.viz-help-item strong {
  color: #0f172a;
}

.viz-summary,
.viz-details {
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.5;
}

.viz-summary .muted,
.viz-details .muted {
  color: var(--viz-muted);
}

.viz-graph-card {
  padding-bottom: 10px;
}

.viz-graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#vizGraph {
  width: 100%;
  height: 76vh;
  min-height: 620px;
  border: 1px solid var(--viz-border);
  border-radius: 12px;
  background: #fcfdff;
}

.viz-legend-card {
  padding-top: 14px;
}

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

.viz-legend-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.5;
}

.viz-legend-item strong {
  color: #0f172a;
}

.viz-legend-node {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  margin-top: 2px;
}

.viz-legend-node--annotation {
  background: #93c5fd;
}

.viz-legend-node--segment {
  background: #f1f5f9;
}

.viz-legend-line {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 3px solid #64748b;
  margin-top: 12px;
  position: relative;
}

.viz-legend-line--relation::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -6px;
  border-left: 8px solid #64748b;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.viz-legend-line--membership {
  border-top-style: dashed;
  border-top-color: #cbd5e1;
}

.viz-legend-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eef2f7;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.55;
}

.viz-table-wrap {
  overflow: auto;
}

.viz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.viz-table th,
.viz-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

.viz-table th {
  background: #f8fafc;
  position: sticky;
  top: 0;
}

.viz-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-size: 0.78rem;
}

.viz-meta {
  display: grid;
  gap: 6px;
}

.viz-meta strong {
  color: #0f172a;
}

.viz-mini {
  color: var(--viz-muted);
  font-size: 0.84rem;
}

@media (max-width: 1100px) {
  .viz-page {
    grid-template-columns: 1fr;
  }

#vizGraph {
  height: 62vh;
  min-height: 460px;
}

.viz-legend-grid {
  grid-template-columns: 1fr;
}

}
